package top.zywork.dao;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import top.zywork.dos.GoodsInfoDO;
import top.zywork.dos.GoodsSkuActivityDO;

import java.util.List;

/**
 * GoodsInfoDAO数据访问接口<br/>
 *
 * 创建于2019-07-04<br/>
 *
 * @author http://zywork.top 王振宇
 * @version 1.0
 */
@Repository
public interface GoodsInfoDAO extends BaseDAO {

    @Override
    List<Object> listAllByCondition(@Param("query") Object queryObj);

    @Override
    List<Object> listPageByCondition(@Param("query") Object queryObj);

    @Override
    Long countByCondition(@Param("query") Object queryObj);

    /**
     * 更新商品的点击量
     * @param goodsId
     * @return
     */
    int updateClickCount(Long goodsId);

    /**
     * 批量更新商品的销量数据，用于提交订单和取消订单时
     * @param goodsInfoDOList
     * @return
     */
    int updateSaleCountBatch(List<GoodsInfoDO> goodsInfoDOList);

    /**
     * 查询sku的活动信息
     * @param shopId 店铺id
     * @param goodsId 商品id
     * @param goodsSkuIds sku的id
     * @return
     */
    List<GoodsSkuActivityDO> listCountActivityGoods(@Param("shopId") Long shopId, @Param("goodsId") Long goodsId, @Param("goodsSkuIds") String[] goodsSkuIds);

}
